Skip to content

More optimizations - #13

Merged
jlamypoirier merged 10 commits into
mainfrom
more_optimizations
Mar 2, 2023
Merged

jlamypoirier merged 10 commits into
mainfrom
more_optimizations

Conversation

@jlamypoirier

@jlamypoirier jlamypoirier commented Feb 23, 2023 •

Copy link
Copy Markdown
Collaborator
  • Use linear layers instead of Conv1d. (CPU, GPU optimization)
  • Merge the key and value caches, and change how layer_past/presents is stored. (CPU, GPU)
  • Change the memory layout of MHA key-value from (2, self.num_heads, self.head_dim) to (self.num_heads, 2, self.head_dim) as needed to merge the caches efficiently. This is different from transformers GPT2, but it now matches Megatron-LM. (GPU)
  • Avoid redundant views from split_heads and merge_heads with MQA. Also move these functions inline (CPU)
  • Remove _matmul and put back specialized versions in _attn to save some cpu time. (CPU).
  • Adapt the conversion script to the new memory layout and trim it down.
  • New converted model is in the linear branch of bigcode/santacoder-fast-inference.

@jlamypoirier
jlamypoirier marked this pull request as ready for review February 24, 2023 01:58
@jlamypoirier
jlamypoirier merged commit b989169 into main Mar 2, 2023
@jlamypoirier
jlamypoirier deleted the more_optimizations branch March 2, 2023 19:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant